<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="../ct-builder-list.html">

<link rel="import" href="../ct-builder.html">
<link rel="import" href="../ct-step-failure.html">

<script>
(function () {

var assert = chai.assert;

var kExampleFailures = [
  new CTStepFailure('layout_tests', "plugins/gesture-events-scrolled.html",
    {
      "WebKit Win7 (dbg)": {
        "actual": "CRASH",
        "masterUrl": "https://master-one",
        "failingBuildCount": 2,
      },
      "WebKit Mac10.6 (dbg)": {
        "actual": "CRASH",
        "masterUrl": "https://master-one",
        "failingBuildCount": 1,
      },
      "WebKit Mac10.7": {
        "actual": "TEXT",
        "masterUrl": "https://master-one",
        "failingBuildCount": 1,
      }
    }, 177164, 177165),
  new CTStepFailure('layout_tests', "plugins/transformed-events.html",
    {
      "WebKit Win7 (dbg)": {
        "actual": "TEXT",
        "masterUrl": "https://master-one",
        "failingBuildCount": 2,
      },
      "WebKit Mac10.7": {
        "actual": "CRASH",
        "masterUrl": "https://master-two",
        "failingBuildCount": 1,
      },
    }, 177164, 177165
  )
];

describe('ct-builder-list', function() {
  it('should create a correct list', function() {
    var builderList = new CTBuilderList(kExampleFailures);

    assert.lengthOf(builderList.builders, 4);
    assert.deepEqual(builderList.builders[0], new CTBuilder(
        'https://master-one', 'WebKit Mac10.6 (dbg)', 1));
    assert.deepEqual(builderList.builders[1], new CTBuilder(
        'https://master-one', 'WebKit Mac10.7', 1));
    assert.deepEqual(builderList.builders[2], new CTBuilder(
        'https://master-two', 'WebKit Mac10.7', 1));
    assert.deepEqual(builderList.builders[3], new CTBuilder(
        'https://master-one', 'WebKit Win7 (dbg)', 2));
  });
});

})()
</script>
